﻿<%@ Page Language="VB" MasterPageFile="~/HelpDesk.master" AutoEventWireup="true"
    CodeFile="Nouveau.aspx.vb" Inherits="Tickets_Nouveau" Title="Nouveau ticket"
    EnableViewState="false" Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="aspAjax" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:SqlDataSource ID="SqlTicket" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
        InsertCommand="INSERT INTO [Ticket] ([projet_id], [priorite_id], [typeticket_id], [ticket_auteur], [ticket_sujet], [ticket_date], [ticket_client], [ticket_datemodification]) VALUES (@projet_id, @priorite_id, @typeticket_id, @ticket_auteur, @ticket_sujet, GETDATE(), 1, GETDATE())"
        SelectCommand="SELECT Ticket.ticket_id, Ticket.projet_id, Ticket.priorite_id, Ticket.typeticket_id, Ticket.ticket_auteur, Ticket.ticket_sujet, Ticket.ticket_resolu, Ticket.ticket_date, Ticket.ticket_client, Ticket.ticket_datemodification, Ticket.ticket_dateresolution, TypeTicket.typeticket_label, Priorite.priorite_label, Projet.projet_nom FROM Ticket INNER JOIN TypeTicket ON Ticket.typeticket_id = TypeTicket.typeticket_id INNER JOIN Priorite ON Ticket.priorite_id = Priorite.priorite_id INNER JOIN Projet ON Ticket.projet_id = Projet.projet_id WHERE (Ticket.ticket_id = @ticket_id)">
        <SelectParameters>
            <asp:QueryStringParameter Name="ticket_id" QueryStringField="ticket_id" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="projet_id" Type="Int32" />
            <asp:Parameter Name="priorite_id" Type="Int32" />
            <asp:Parameter Name="typeticket_id" Type="Int32" />
            <asp:Parameter Name="ticket_auteur" Type="String" />
            <asp:Parameter Name="ticket_sujet" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:FormView ID="FormViewTicket" runat="server" DataKeyNames="ticket_id" DataSourceID="SqlTicket"
        DefaultMode="Insert" meta:resourcekey="FormViewTicketResource1">
        <InsertItemTemplate>
            <h1>
                <asp:Literal ID="Literal1" runat="server" meta:resourcekey="Literal1Resource1" Text="Nouveau ticket"></asp:Literal>
            </h1>
            <table class="tblFormulaire">
                <tr>
                    <th colspan="6">
                        <asp:Literal ID="Literal2" runat="server" meta:resourcekey="Literal2Resource1" Text="<%$ Resources:Tickets, TicketSubject %>"></asp:Literal>
                    </th>
                </tr>
                <tr>
                    <td colspan="6">
                        <asp:TextBox ID="ticket_sujetTextBox" runat="server" Text='<%# Bind("ticket_sujet") %>'
                            Width="100%" meta:resourcekey="ticket_sujetTextBoxResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorSujet" runat="server" ControlToValidate="ticket_sujetTextBox"
                            ErrorMessage="*" meta:resourcekey="RequiredFieldValidatorSujetResource1"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <th colspan="6">
                        <asp:Literal ID="Literal3" runat="server" meta:resourcekey="Literal3Resource1" Text="<%$ Resources:Tickets, TicketComments %>"></asp:Literal>
                    </th>
                </tr>
                <tr>
                    <td colspan="6">
                        <FCKeditorV2:FCKeditor ID="FCKeditorCommentaire" runat="server" ToolbarSet="HelpDesk"
                            Height="200px" Width="100%">
                        </FCKeditorV2:FCKeditor>
                    </td>
                </tr>
                <tr>
                    <th>
                        <asp:Literal ID="Literal4" runat="server" meta:resourcekey="Literal4Resource1" Text="<%$ Resources:Tickets, TicketAuthor %>"></asp:Literal>
                    </th>
                    <td>
                        <asp:Label ID="ticket_auteurLabel" runat="server" Text='<%# HttpContext.Current.User.Identity.Name %>'
                            meta:resourcekey="ticket_auteurLabelResource1"></asp:Label>
                    </td>
                    <th>
                        <asp:Literal ID="Literal5" runat="server" meta:resourcekey="Literal5Resource1" Text="<%$ Resources:Tickets, TicketPriority %>"></asp:Literal>
                    </th>
                    <td>
                        <asp:SqlDataSource ID="SqlPriorite" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
                            SelectCommand="SELECT [priorite_id], [priorite_label] FROM [Priorite] ORDER BY [priorite_ordre]">
                        </asp:SqlDataSource>
                        <asp:DropDownList ID="DropDownListPriorite" runat="server" DataSourceID="SqlPriorite"
                            DataTextField="priorite_label" DataValueField="priorite_id" SelectedValue='<%# Bind("priorite_id") %>'
                            meta:resourcekey="DropDownListPrioriteResource1">
                        </asp:DropDownList>
                    </td>
                    <th>
                        <asp:Literal ID="Literal6" runat="server" meta:resourcekey="Literal6Resource1" Text="<%$ Resources:Tickets, TicketType %>"></asp:Literal>
                    </th>
                    <td>
                        <asp:SqlDataSource ID="SqlType" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
                            SelectCommand="SELECT [typeticket_id], [typeticket_label] FROM [TypeTicket] ORDER BY [typeticket_ordre]">
                        </asp:SqlDataSource>
                        <asp:DropDownList ID="DropDownListType" runat="server" DataSourceID="SqlType" DataTextField="typeticket_label"
                            DataValueField="typeticket_id" SelectedValue='<%# Bind("typeticket_id") %>' meta:resourcekey="DropDownListTypeResource1">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        <asp:Literal ID="Literal7" runat="server" meta:resourcekey="Literal7Resource1" Text="<%$ Resources:Tickets, TicketProject %>"></asp:Literal>
                    </th>
                    <td colspan="5">
                        <asp:SqlDataSource ID="SqlProjet" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskCS %>"
                            SelectCommand="SELECT projet_id, projet_nom FROM Projet WHERE (entreprise_id = @entreprise_id) ORDER BY projet_nom">
                            <SelectParameters>
                                <asp:ProfileParameter Name="entreprise_id" PropertyName="entreprise_id" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:DropDownList ID="DropDownListProjet" runat="server" DataSourceID="SqlProjet"
                            DataTextField="projet_nom" DataValueField="projet_id" SelectedValue='<%# Bind("projet_id") %>'
                            meta:resourcekey="DropDownListProjetResource1">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="6">
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="<%$ Resources:WebResource, ButtonSave %>"
                            meta:resourcekey="InsertButtonResource1"></asp:Button>
                        <a href="Liste.aspx">
                            <asp:Literal ID="Literal8" runat="server" meta:resourcekey="Literal8Resource1" Text="<%$ Resources:WebResource, ButtonCancel %>"></asp:Literal>
                        </a>
                    </td>
                </tr>
            </table>
        </InsertItemTemplate>
    </asp:FormView>
</asp:Content>
